﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using System.Runtime.Serialization;

namespace WcfServiceBomberman.Contracts.Duplex
{
    [ServiceContract(CallbackContract = typeof(IServiceGameServerCallback))]
    interface IServiceGameServer
    {
        [OperationContract(IsOneWay = true)]
        void register();
        
        [OperationContract(IsOneWay = true)]
        void onGameCreated(GameCreatedArgs args);

        [OperationContract(IsOneWay = true)]
        void onGameFinished(GameFinishedArgs args);
    }

    [DataContract]
    public struct GameCreatedArgs
    {
        [DataMemberAttribute]
        public UInt16 game_id;
        [DataMemberAttribute]
        public UInt32 port;
        [DataMemberAttribute]
        public GameCreatedArgs_Player[] players;
    }

    [DataContract]
    public struct GameCreatedArgs_Player
    {
        [DataMemberAttribute]
        public UInt32 uid;
        [DataMemberAttribute]
        public UInt32 token;
    }

    [DataContract]
    public struct GameFinishedArgs
    {
        [DataMemberAttribute]
        UInt16 game_id;
        [DataMemberAttribute]
        UInt16 winner_id;
        [DataMemberAttribute]
        GameFinishedArgs_Team[] teams;
    }

    [DataContract]
    public struct GameFinishedArgs_Team
    {
        [DataMemberAttribute]
        UInt16 team_id;
        [DataMemberAttribute]
        Int16 score;
        [DataMemberAttribute]
        GameFinishedArgs_Player[] players;
    }

    [DataContract]
    public struct GameFinishedArgs_Player
    {
        [DataMemberAttribute]
        UInt32 uid;
        [DataMemberAttribute]
        UInt16 kills;
        [DataMemberAttribute]
        UInt16 deaths;
        [DataMemberAttribute]
        UInt16 suicides;
    }
}
